package com.xlh.param.cases;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.xlh.util.InputValidator;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * 案例参数
 * <p>
 * Created by lx on 2019/2/26.
 */
@Data
public class CaseLibraryParam {

    @ApiModelProperty(value = "案例标题")
    @JsonProperty("caseTitle")
    @NotBlank(message = "案例标题不能为空")
    @Length(max = 50, message = "请正确填写案例标题，最多可输入50字符")
    private String title;

    @ApiModelProperty(value = "案例简介")
    @JsonProperty("caseIntro")
    @NotBlank(message = "案例简介不能为空")
    @Length(max = 200, message = "请正确填写案例简介，最多可输入200字符")
    private String intro;

    @ApiModelProperty(value = "案例内容")
    @JsonProperty("caseContent")
    private String content;

    @ApiModelProperty(value = "图片名")
    private String file;

    public String getTitle() {
        return title == null ? null : InputValidator.regSpecialChar(title);
    }

}
